/**
* 提现结果
*/
import React, { Component } from 'react';
import { View, StyleSheet, Text, Image, TouchableOpacity, FlatList, ScrollView } from "react-native";
import { connect } from 'react-redux';
import { create_service } from '../../redux/index.js';
import { Contract } from '../../service/index.js';
import { Colors, Dimens, ImageRes } from '../../utils/Assets';
import { ProgressView } from '../custom/index'
import { Actions } from 'react-native-router-flux';
import { getStore } from '../../redux/index.js';
class ProfitWithdrawResultView extends Component {

    constructor(props) {
        super(props);
        this.state = {
            loading: false
        }
        this.userInfo = getStore().getState().auth.userInfo
    }

    componentDidMount() {
        this.getDetailData()
    }
    getDetailData() {
        this.setState({ loading: true })
        this.props.dispatch(create_service(Contract.POST_USER_CASH_INFO, {
            token: this.userInfo.token,
            cash_id: this.props.cash_id,
        })).then((res) => {
            if (res) {
                this.detailData = res
            }
            this.setState({ loading: false })
        })
    }
    componentWillUnmount() {
    }
    render() {
        return (
            <View style={styles.container}>
                {this.detailData && <ScrollView showsVerticalScrollIndicator={false} style={{ backgroundColor: "#ffffff" }}>
                    <Image source={ImageRes.profit_result} style={{ width: 200, height: 0.67 * 200, marginTop: 80, alignSelf: 'center' }}></Image>
                    <Text style={{ fontSize: 18, color: '#378EFB', fontWeight: 'bold', marginTop: 30, alignSelf: 'center' }}>提现申请已提交</Text>
                    <Text style={{ fontSize: 18, color: '#999999', marginTop: 15, alignSelf: 'center' }}>
                        {`预计${this.detailData.estimated_time}前到账`}
                    </Text>
                    <View style={{ backgroundColor: Colors.bg_color, height: 1, marginTop: 30 }}></View>
                    <View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 15 }}>
                        <Text style={{ fontSize: 16, color: "#999999" }}>提现金额</Text>
                        <Text style={{ fontSize: 16, color: '#333333' }}>{'￥' + this.detailData.amount}</Text>
                    </View>
                    <View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 15 }}>
                        <Text style={{ fontSize: 16, color: "#999999" }}>到账银行卡</Text>
                        <Text style={{ fontSize: 16, color: '#333333' }}>{`${this.detailData.bank_name}(${this.detailData.card_number})`}</Text>
                    </View>
                    <View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 15 }}>
                        <Text style={{ fontSize: 16, color: "#999999" }}>服务费</Text>
                        <Text style={{ fontSize: 16, color: '#333333' }}>{"￥" + this.detailData.fee}</Text>
                    </View>
                </ScrollView>}
                <ProgressView show={this.state.loading} />
            </View >
        )
    }
}
const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: Colors.bg_color,
    }
});
const ExportView = connect()(ProfitWithdrawResultView);
module.exports.ProfitWithdrawResultView = ExportView
